﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using QdpzWtm.Models;
using QdpzWtm.Models.BaseSeting;


namespace QdpzWtm.ViewModels.ArticleManagementVMs
{
    public partial class ArticleManagementVM : BaseCRUDVM<ArticleManagement>
    {
        public List<ComboSelectListItem> AllArticleManagementTypes { get; set; }

        public ArticleManagementVM()
        {
            SetInclude(x => x.ArticleManagementType);
            SetInclude(x => x.Photos);
        }

        protected override void InitVM()
        {
            AllArticleManagementTypes = DC.Set<ArticleManagementType>().GetSelectListItems(Wtm, y => y.ArticleManagementTypeName);
        }

        public override void DoAdd()
        {     
            Entity.UpTime = DateTime.Now;
            base.DoAdd();
        }

        public override void DoEdit(bool updateAllFields = false)
        {
            Entity.UpTime = DateTime.Now;
            base.DoEdit(updateAllFields);
        }

        public override void DoDelete()
        {
            base.DoDelete();
        }
    }
}
